package com.luzhikun.KnowledgeReview.model;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/*
 * @Author liu-miss
 * @Description 模板模式
 * @Date 22:17 2021/5/14
 **/

public class ModeoServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        
        // 获取请求的地址
        String servletPath = request.getServletPath();
        
        if ("/student/save.do".equals(servletPath)){
           save(request,response);
        }else if ("/student/update.do".equals(servletPath)){
            update(request,response);
        }else if ("/student/delect.do".equals(servletPath)){
            delect(request,response);
        }else if ("/student/select.do".equals(servletPath)){
            select(request,response);
        }
    }

    private void select(HttpServletRequest request, HttpServletResponse response) {
        System.out.println("执行查询操作");
    }

    private void delect(HttpServletRequest request, HttpServletResponse response) {
        System.out.println("执行删除操作");
    }

    private void update(HttpServletRequest request, HttpServletResponse response) {
        System.out.println("执行更新操作");
    }

    private void save(HttpServletRequest request, HttpServletResponse response) {
        System.out.println("执行添加操作");
    }
}
